public class TestDemo5 {
    public static void main(String[] args) {
        int[] arr = {4,1,2,1,2};
        find(arr);
    }

    public static void find(int[] arr){
        for (int i = 0; i < arr.length; i++) {
            boolean flg = false;
            for(int j = i+1; j < arr.length; j++){
                if(j == i){
                    continue;
                }
                if(arr[i] == arr[j]){
                    flg = true;
                    break;
                }
            }
            if(flg == false){
                System.out.println(arr[i]);
                break;
            }
        }
    }
}
